package com.my.hotel.mapper;

import com.my.hotel.entity.Order;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface TbOrderMapper {
    @Select("select * from tb_order where order_num like \"%\"#{order_num}\"%\" and order_status LIKE \"%\"#{order_status}\"%\" and user_id LIKE \"%\"#{user_id}\"%\" and 1=1")
    public List<Order> getList(@Param("order_num") String order_num, @Param("order_status") String order_status, @Param("user_id") String user_id);
  /*//删除订单
    @Delete("delete from tb_order where id=#{id}")
    public void delOdr(int id);*/
   //预定
    @Update("update tb_order set order_status=0,order_pay_status=1 where id=#{id}")
    public void preOdr(int id);
    //入住
    @Update("update tb_order set order_status=2,order_pay_status=1 where id=#{id}")
    public void liveOdr(int id);
    //退房
    @Update("update tb_order set order_status=3,order_pay_status=1 where id=#{id}")
    public void returnOdr(int id);
    //取消
    @Update("update tb_order set order_status=1,order_pay_status=2 where id=#{id}")
    public void calOdr(int id);
}
